<script>
import {mapMutations, mapState,mapActions} from "vuex";

export default {
  computed: {
    ...mapState(["userInfo"])
  },
  methods: {
    /*change(){
      this.$store.commit("changeUserInfoAction","马云")
    }*/
    ...mapActions(["changeUserInfoAction"]),

    change() {
      this.changeUserInfoAction("马云")
    }
  }
}
</script>

<template>
  <div class="layui-panel home">
    <h1>about组件</h1>
    <h1>userInfo的name:{{ userInfo.name }}</h1>
    <h1>userInfo的age:{{ userInfo.age }}</h1>
    <h1>userInfo的address:{{ userInfo.address }}</h1>
    <button type="button" class="layui-btn" @click="change">从about组件中修改store中的userInfo</button>
  </div>
</template>

<style scoped lang="less"></style>